package com.jk.dmconsumer.djhController;

import com.jk.dmcommon.djhEntity.CityEntity;
import com.jk.dmcommon.djhEntity.GoodsTypeEntity;
import com.jk.dmcommon.entity.ShopEntity;
import com.jk.dmconsumer.djhService.SelectOneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("selectOnePage")
public class SelectOneController {
    @Autowired
    private SelectOneService selectOneService;

    /**
     * cheng shi  biao
     * @return
     */
    @RequestMapping("selectAllCity")
    public String selectAllCity(){
        List<CityEntity> cityEntities = selectOneService.selectAllCity();
        String str = "";
        for (CityEntity c: cityEntities
             ) {
            str+="<span data-v-69d634e0=\"\" title="+c.getCityId()+" class=\"factor-content-item cityName\" onclick=\"cityselect(this)\"> "+c.getCityName()+" </span>";
        }
        return str;
    }

    /**
     *
     */
    @RequestMapping("selectAllType")
    public String selectAllType(){
        List<GoodsTypeEntity> cityEntities = selectOneService.selectAllType();
        String str = "";
        for (GoodsTypeEntity g: cityEntities
        ) {
            str+="<span data-v-69d634e0=\"\" title="+g.getGoodsTypeId()+" class=\"factor-content-item typeName\" onclick=\"typeselect(this)\"> "+g.getGoodsTypeName()+" </span>";
        }
        return str;
    }

    /**
     * cha xun shang pin
     *
     */
    @RequestMapping("selectGoodsByType")
    public String selectGoodsByType(String cityId,String typeId,String timeShow,String searchButtongoods ,Integer orderdesc){
        List<ShopEntity> goodsEntities = selectOneService.selectGoodsByType(cityId, typeId, timeShow,searchButtongoods,orderdesc);
        String str = "";
        for (ShopEntity g: goodsEntities
             ) {
            str+=" <div data-v-0a2cd810=\"\" class=\"items\">\n" +
                    "                            <a data-v-0a2cd810=\"\" href=\"/lwl?goodsId="+g.getGoodsId()+"\" target=\"_blank\" class=\"items__img\"><span data-v-0a2cd810=\"\" class=\"items__img__tag\">"+g.getGoodsTypeName()+"</span> <img data-v-0a2cd810=\"\" alt=\"项目图片\" data-src=\"//img.alicdn.com/bao/uploaded/https://img.alicdn.com/imgextra/i2/2251059038/O1CN01UmQvKP2GdSLSxudx4_!!2251059038.png_q60.jpg_.webp\" src=\""+g.getGoodsImg()+"\" lazy=\"loaded\" /></a>\n" +
                    "                            <div data-v-0a2cd810=\"\" class=\"items__txt\">\n" +
                    "                                <div data-v-0a2cd810=\"\" class=\"items__txt__title\">\n" +
                    "                                    <a data-v-0a2cd810=\"\" href=\"lwl?goodsId="+g.getGoodsId()+"\" target=\"_blank\">"+g.getGoodsName()+"</a>\n" +
                    "                                </div>\n" +
                    "                                <div data-v-0a2cd810=\"\" class=\"items__txt__time\">\n" +
                    "                                    艺人："+g.getGoodsMainActor()+"\n" +
                    "                                </div>\n" +
                    "                                <div data-v-0a2cd810=\"\" class=\"items__txt__time\">\n" +
                    "                                    <a data-v-0a2cd810=\"\" href=\"javascript:;\" class=\"items__txt__venue__icon\"></a> "+g.getGoodsAdress()+"\n" +
                    "                                </div>\n" +
                    "                                <div data-v-0a2cd810=\"\" class=\"items__txt__time\">\n" +
                    "                                    <a data-v-0a2cd810=\"\" href=\"javascript:;\" class=\"items__txt__time__icon\"></a>"+g.getGoodsStartTime()+"\n" +
                    "                                </div>\n" +
                    "                                <div data-v-0a2cd810=\"\" class=\"items__txt__tags\">\n" +
                    "                                    <!---->\n" +
                    "                                    <span data-v-0a2cd810=\"\" class=\"xuanzuo\">可选座</span>\n" +
                    "                                </div>\n" +
                    "                                <!---->\n" +
                    "                                <div data-v-0a2cd810=\"\" class=\"items__txt__price\">\n" +
                    "                                    <span data-v-0a2cd810=\"\">123<i data-v-0a2cd810=\"\">元</i></span> 售票中\n" +
                    "                                </div>\n" +
                    "                            </div>\n" +
                    "                        </div>";
        }
        return str;
    }

    /**
     * 查询数量
     */
    @RequestMapping("selectGoodsCount")
    public Integer selectGoodsCount(String cityId,String typeId,String timeShow,String searchButtongoods ,Integer orderdesc){
        return selectOneService.selectGoodsCount(cityId,typeId,timeShow,searchButtongoods,orderdesc);
    }
}
